from aip import AipNlp


class Baidu(object):
    aipNlp = None

    def __init__(self):
        # 定义常量
        APP_ID = '10343182'
        API_KEY = '91NVKVSHkTss0G7lKdYBQooX'
        SECRET_KEY = 'PMrfZTMsP3P9UWK4wYjbBdFGvT7wU7tx'

        # 初始化AipNlp对象
        self.aipNlp = AipNlp(APP_ID, API_KEY, SECRET_KEY)

    def word_similarity(self, word1, word2):
        result = self.aipNlp.simnet(word1, word2)
        return result


re = Baidu().word_similarity("长得好看的", "美丽")
print(re)
